package github.kawaiior.yuanchuxiuzhen.common.entity.addon.model;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import github.kawaiior.yuanchuxiuzhen.common.entity.addon.HostCrabEntity;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.ModelRenderer;

public class HostCrabEntityModel extends EntityModel<HostCrabEntity> {

    private final ModelRenderer mainBody;

    public HostCrabEntityModel(){
        this.textureWidth = 20;
        this.textureHeight = 17;

        this.mainBody = new ModelRenderer(this);
        this.mainBody.setRotationPoint(0.0F, 24.0F, 0.0F);

        addBox(0, 0, -3.0F, -3.0F, -2.0F, 6, 3, 4, 0.0F, false);
        addBox(0, 8, -2.0F, -2.0F, 2.0F, 4, 2, 1, 0.0F, false);
        addBox(0, 11, -4.0F, -1.0F, -2.0F, 1, 1, 5, 0.0F, false);
        addBox(0, 11, 3.0F, -1.0F, -2.0F, 1, 1, 5, 0.0F, false);
        addBox(10, 8, -4.0F, -2.0F, -4.0F, 3, 2, 2, 0.0F, false);
        addBox(10, 12, 1.0F, -2.0F, -4.0F, 3, 2, 2, 0.0F, false);
        addBox(0, 2, -2.0F, -4.0F, -3.0F, 1, 1, 1, 0.0F, false);
        addBox(0, 2, 1.0F, -4.0F, -3.0F, 1, 1, 1, 0.0F, false);
    }

    private void addBox(int tx, int ty, float x, float y, float z, float width, float height, float depth, float delta, boolean mirrorIn){
        ModelRenderer mr = new ModelRenderer(this);
        this.mainBody.addChild(mr);
        mr.setTextureOffset(tx, ty).addBox(x,y,z,width,height,depth,delta,mirrorIn);
    }

    @Override
    public void setRotationAngles(HostCrabEntity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {

    }

    @Override
    public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
        this.mainBody.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
    }
}
